import { defHttp } from '/@/utils/http/axios'
import {
  getProcessParams,
  getProcessModel,
  getContainerParams,
  getContainerModel,
} from './model/topoModel'

import { ErrorMessageMode } from '/#/axios'

enum Api {
  getProcess = '/topo/getProcess',
  getContainer = '/topo/getContainer',
}
/**
 * @param params 服务器序号
 * @param mode 错误类型
 * @returns 进程列表
 */
export function getProcessApi(params: getProcessParams, mode: ErrorMessageMode = 'modal') {
  return defHttp.get<getProcessModel>(
    {
      url: Api.getProcess,
      params,
    },
    {
      errorMessageMode: mode,
    },
  )
}
/**
 * @param params 服务器序号
 * @param mode 错误类型
 * @returns 容器列表
 */
export function getContainerApi(params: getContainerParams, mode: ErrorMessageMode = 'modal') {
  return defHttp.get<getContainerModel>(
    {
      url: Api.getContainer,
      params,
    },
    {
      errorMessageMode: mode,
    },
  )
}
